home *** CD-ROM | disk | FTP | other *** search
- /* copy2.c */
-
- #include <stdio.h>
- #include <stdlib.h>
-
- main(int argc, char *argv[])
- {
- char s[BUFSIZ];
-
- /* Open optional input file */
- if (argc > 1)
- if (freopen(argv[1],"r",stdin) == NULL)
- return EXIT_FAILURE;
-
- /* Open optional output file */
- if (argc > 2)
- if (freopen(argv[2],"w",stdout) == NULL)
- return EXIT_FAILURE;
-
- while (gets(s))
- puts(s);
- return EXIT_SUCCESS;
- }
-
-